!function(){

    $(function(){
                var myChart = echarts.init(document.getElementById('report'));
                var $typeArr = [];
                var $personArr = [];
                $.each($('.conType tbody tr'),function(){
                    $typeArr.push($(this).children().eq(0).text());
                    $personArr.push($(this).children().eq(1).text());
                })
                var option = {

                    tooltip : {
                        trigger: 'item',
                        formatter: "{d}%"
                    },
                    textStyle : {
                        color:'#6f6f6f',
                    },
                    series : [
                        {
                            name: '次均消费',
                            type: 'pie',
                            radius : ['35%', '55%'],
                            center: ['50%', '50%'],
                            data:[
                                {value:$personArr[0], name:$typeArr[0]+'('+$personArr[0]+'人)'},
                                {value:$personArr[1], name:$typeArr[1]+'('+$personArr[1]+'人)'},
                                {value:$personArr[2], name:$typeArr[2]+'('+$personArr[2]+'人)'},
                                {value:$personArr[3], name:$typeArr[3]+'('+$personArr[3]+'人)'},
                                {value:$personArr[4], name:$typeArr[4]+'('+$personArr[4]+'人)'},
                                {value:$personArr[5], name:$typeArr[5]+'('+$personArr[5]+'人)'}
                            ],
                            itemStyle: {
                                normal: {
                                    label: {
                                        show: function () {
                                            if (data.value == 0){
                                                return false;
                                            }else {
                                                return true
                                            }
                                        },
                                        labelLine: {
                                            show: function () {
                                                if (value == 0)
                                                { return false; }
                                            }
                                        }
                                    }
                                } ,
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }

                            }
                        }
                    ],
                    color: [
                        '#ffb230', '#fe7b9d', '#e8477d', '#fa6382', '#e8477d',
                        '#fe9494', '#ba55d3', '#cd5c5c', '#ffa500', '#40e0d0',
                        '#1e90ff', '#ff6347', '#7b68ee', '#00fa9a', '#ffd700',
                        '#6b8e23', '#ff00ff', '#3cb371', '#b8860b', '#30e0e0'
                    ]
                };
                myChart.setOption(option);
    })


}();